
#pragma once

dsSTRING MacrosPreprocess(const dsSTRING & text_, dsVECTOR<int> & lineCorrection);

namespace ds {
   dsSTRING SetIndent(const dsSTRING & text, int indent);
}

struct Macros {
   py::list lineCorrection;
   std::string source;
   std::string code;

   Macros(std::string source, bool isSimplePython)
      : source(source)
   {
      if (isSimplePython) {
         code = ds::SetIndent(source.c_str(), 0).CStr();
      } else {
         dsVECTOR<int> lc;
         code = MacrosPreprocess(source.c_str(), lc).CStr();
         for (int i = 0; i < lc.Length(); ++i) {
            lineCorrection.append(py::object(lc[i]));
         }
      }
   }

   static std::string OutputMethod;
   static void set_OutputMethod(std::string val) {
      OutputMethod = val;
   }

   static std::string get_OutputMethod(void) {
      return OutputMethod;
   }
};
